<template>
    <div id="lisft">
        <h2>为你推荐</h2>
        <div class="listfta">
            <div v-for="item in lisftx" :key="item.productId" class="daft" @click="fotfoo(item.productId)">
                <div>
                    <img :src="item.image">
                </div>
                <div>
                    <p>{{item.name}}</p>
                    <p class="fotyan">{{item.desc}}</p>
                    <span>¥ {{item.linePrice | litfoos}}</span>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import http from '@/util/http'
export default {
  data () {
    return {
      lisftx: []
    }
  },
  filters: {
    litfoos (pas) {
      return pas / 100
    }
  },
  mounted () {
    http({
      url: '/heihei/api/product/product/product_list?c=h5&s=20000&t=1605261967895&v=1.0&category_id=0&sort_field=1&sort_order=2&pn=1&ps=4'
    }).then(res => {
      this.lisftx = res.data.data.pageList
    })
  },
  methods: {
    fotfoo (id) {
      console.log(id)
      // this.$router.push({ path: '/pages/detail/detail', query: { id: id } })
    }
  }
}
</script>
<style lang="scss" scoped>
    #lisft{
        border-top: 10px solid #ccc;
        h2{
            height: 50px;
            padding: 15px 10px 10px 10px;
            line-height: 1.6;
            font-size: 18px;
            font-weight: 100;
        }
        .listfta{
            display: flex;
            flex-wrap: wrap;
            .daft{
                padding: 10px;
                flex: 50%;
                overflow: hidden;

                img{
                    width: 100%;
                    height: 100%;
                }
                p{
                    width: 100%;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                    overflow: hidden;
                    font-size: 14px;
                    line-height: 20px;
                }
                .fotyan{
                    font-size: 13px;
                    color: #8c8c8c;
                }
               div{
                    span{
                    color: #eb4949;
                    font-weight: 700;
                    font-size: 14px;
                }
               }
            }
        }
    }
</style>
